const crypto = require('crypto')
const {argv} = require('yargs')
const {mongoose} = require('../core/mongodb')
const autoIncrement = require('mongoose-auto-increment')
const userSchema=new mongoose.Schema({
    name:{type:String,required:true,default:''},
    avatar:{type:String,required:true,default:''},
    authority:{type:String,required:true,default:'user'},
    phone:{type:String,required:true,default:''},
    email:{type:String,required:true,default:''},
    password:{type:String,required:true,default:crypto.createHash('md5').update(argv.auth_default_password||'root').digest('hex')},
    create_time:{type:Date,default:Date.now},
    update_time:{type:Date,default:Date.now}
})
// userSchema.plugin(autoIncrement.plugin,'USER')
module.exports=mongoose.model('USER',userSchema,'USER')
